<template>
  <div>
    <MyHeader bgColor="#78bb7b" fontColor="pink" title="购物车案例" />
    <div class="list" style="padding: 45px 0 50px">
      <MyGoods v-for="obj in list" :key="obj.id" :goodsObj="obj"/>
    </div>
    <MyFooter :goodsArr="list"/>
  </div>
</template>

<script>
import MyHeader from "./components/MyHeader.vue";
import MyGoods from "./components/MyGoods.vue";
import MyFooter from "./components/MyFooter.vue";
export default {
  data() {
    return {
      list: [],
    };
  },
  components: {
    MyHeader,
    MyGoods,
    MyFooter,
  },
  async created() {
    let resp = await this.$http({
      method: "get",
      url: "/api/cart",
    });
    console.log(resp.data);
    this.list = resp.data.list;
    // console.log(this.list);
  },
};
</script>

<style>
</style>